\(\int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx\) [682]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 91 \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=-\frac {b (b c-6 d) x}{d^2}+\frac {2 (b c-3 d)^2 \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \sqrt {c^2-d^2} f}-\frac {b^2 \cos (e+f x)}{d f} \]

[Out]

-b*(-2*a*d+b*c)*x/d^2-b^2*cos(f*x+e)/d/f+2*(-a*d+b*c)^2*arctan((d+c*tan(1/2*f*x+1/2*e))/(c^2-d^2)^(1/2))/d^2/f
/(c^2-d^2)^(1/2)

Rubi [A] (verified)

Time = 0.14 (sec) , antiderivative size = 93, normalized size of antiderivative = 1.02, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {2825, 2814, 2739, 632, 210} \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\frac {2 (b c-a d)^2 \arctan \left (\frac {c \tan \left (\frac {1}{2} (e+f x)\right )+d}{\sqrt {c^2-d^2}}\right )}{d^2 f \sqrt {c^2-d^2}}-\frac {b x (b c-2 a d)}{d^2}-\frac {b^2 \cos (e+f x)}{d f} \]

[In]

Int[(a + b*Sin[e + f*x])^2/(c + d*Sin[e + f*x]),x]

[Out]

-((b*(b*c - 2*a*d)*x)/d^2) + (2*(b*c - a*d)^2*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/(d^2*Sqrt[c^2
- d^2]*f) - (b^2*Cos[e + f*x])/(d*f)

Rule 210

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[-b, 2])^(-1))*ArcTan[Rt[-b, 2]*(x/Rt[-a, 2])
], x] /; FreeQ[{a, b}, x] && PosQ[a/b] && (LtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 2739

Int[((a_) + (b_.)*sin[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x]}, Dis
t[2*(e/d), Subst[Int[1/(a + 2*b*e*x + a*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}, x] &&
 NeQ[a^2 - b^2, 0]

Rule 2814

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[b*(x/d)
, x] - Dist[(b*c - a*d)/d, Int[1/(c + d*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d
, 0]

Rule 2825

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^2/((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(-b^2
)*(Cos[e + f*x]/(d*f)), x] + Dist[1/d, Int[Simp[a^2*d - b*(b*c - 2*a*d)*Sin[e + f*x], x]/(c + d*Sin[e + f*x]),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {b^2 \cos (e+f x)}{d f}+\frac {\int \frac {a^2 d-b (b c-2 a d) \sin (e+f x)}{c+d \sin (e+f x)} \, dx}{d} \\ & = -\frac {b (b c-2 a d) x}{d^2}-\frac {b^2 \cos (e+f x)}{d f}+\frac {(b c-a d)^2 \int \frac {1}{c+d \sin (e+f x)} \, dx}{d^2} \\ & = -\frac {b (b c-2 a d) x}{d^2}-\frac {b^2 \cos (e+f x)}{d f}+\frac {\left (2 (b c-a d)^2\right ) \text {Subst}\left (\int \frac {1}{c+2 d x+c x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{d^2 f} \\ & = -\frac {b (b c-2 a d) x}{d^2}-\frac {b^2 \cos (e+f x)}{d f}-\frac {\left (4 (b c-a d)^2\right ) \text {Subst}\left (\int \frac {1}{-4 \left (c^2-d^2\right )-x^2} \, dx,x,2 d+2 c \tan \left (\frac {1}{2} (e+f x)\right )\right )}{d^2 f} \\ & = -\frac {b (b c-2 a d) x}{d^2}+\frac {2 (b c-a d)^2 \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{d^2 \sqrt {c^2-d^2} f}-\frac {b^2 \cos (e+f x)}{d f} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.74 (sec) , antiderivative size = 87, normalized size of antiderivative = 0.96 \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=-\frac {b (b c-6 d) (e+f x)-\frac {2 (b c-3 d)^2 \arctan \left (\frac {d+c \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {c^2-d^2}}\right )}{\sqrt {c^2-d^2}}+b^2 d \cos (e+f x)}{d^2 f} \]

[In]

Integrate[(3 + b*Sin[e + f*x])^2/(c + d*Sin[e + f*x]),x]

[Out]

-((b*(b*c - 6*d)*(e + f*x) - (2*(b*c - 3*d)^2*ArcTan[(d + c*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/Sqrt[c^2 - d^2
] + b^2*d*Cos[e + f*x])/(d^2*f))

Maple [A] (verified)

Time = 1.13 (sec) , antiderivative size = 119, normalized size of antiderivative = 1.31

method result size
derivativedivides \(\frac {\frac {2 \left (d^{2} a^{2}-2 a b c d +b^{2} c^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}+\frac {2 b \left (-\frac {b d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (2 d a -c b \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{d^{2}}}{f}\) \(119\)
default \(\frac {\frac {2 \left (d^{2} a^{2}-2 a b c d +b^{2} c^{2}\right ) \arctan \left (\frac {2 c \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 d}{2 \sqrt {c^{2}-d^{2}}}\right )}{d^{2} \sqrt {c^{2}-d^{2}}}+\frac {2 b \left (-\frac {b d}{1+\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )}+\left (2 d a -c b \right ) \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )\right )}{d^{2}}}{f}\) \(119\)
risch \(\frac {2 b x a}{d}-\frac {b^{2} x c}{d^{2}}-\frac {b^{2} {\mathrm e}^{i \left (f x +e \right )}}{2 d f}-\frac {b^{2} {\mathrm e}^{-i \left (f x +e \right )}}{2 d f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c \sqrt {-c^{2}+d^{2}}-c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a^{2}}{\sqrt {-c^{2}+d^{2}}\, f}+\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c \sqrt {-c^{2}+d^{2}}-c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a b c}{\sqrt {-c^{2}+d^{2}}\, f d}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c \sqrt {-c^{2}+d^{2}}-c^{2}+d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) b^{2} c^{2}}{\sqrt {-c^{2}+d^{2}}\, f \,d^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c \sqrt {-c^{2}+d^{2}}+c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a^{2}}{\sqrt {-c^{2}+d^{2}}\, f}-\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c \sqrt {-c^{2}+d^{2}}+c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) a b c}{\sqrt {-c^{2}+d^{2}}\, f d}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i c \sqrt {-c^{2}+d^{2}}+c^{2}-d^{2}}{\sqrt {-c^{2}+d^{2}}\, d}\right ) b^{2} c^{2}}{\sqrt {-c^{2}+d^{2}}\, f \,d^{2}}\) \(490\)

[In]

int((a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*(2*(a^2*d^2-2*a*b*c*d+b^2*c^2)/d^2/(c^2-d^2)^(1/2)*arctan(1/2*(2*c*tan(1/2*f*x+1/2*e)+2*d)/(c^2-d^2)^(1/2)
)+2*b/d^2*(-b*d/(1+tan(1/2*f*x+1/2*e)^2)+(2*a*d-b*c)*arctan(tan(1/2*f*x+1/2*e))))

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 375, normalized size of antiderivative = 4.12 \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\left [-\frac {2 \, {\left (b^{2} c^{3} - 2 \, a b c^{2} d - b^{2} c d^{2} + 2 \, a b d^{3}\right )} f x + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {-c^{2} + d^{2}} \log \left (\frac {{\left (2 \, c^{2} - d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2} + 2 \, {\left (c \cos \left (f x + e\right ) \sin \left (f x + e\right ) + d \cos \left (f x + e\right )\right )} \sqrt {-c^{2} + d^{2}}}{d^{2} \cos \left (f x + e\right )^{2} - 2 \, c d \sin \left (f x + e\right ) - c^{2} - d^{2}}\right ) + 2 \, {\left (b^{2} c^{2} d - b^{2} d^{3}\right )} \cos \left (f x + e\right )}{2 \, {\left (c^{2} d^{2} - d^{4}\right )} f}, -\frac {{\left (b^{2} c^{3} - 2 \, a b c^{2} d - b^{2} c d^{2} + 2 \, a b d^{3}\right )} f x + {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} \sqrt {c^{2} - d^{2}} \arctan \left (-\frac {c \sin \left (f x + e\right ) + d}{\sqrt {c^{2} - d^{2}} \cos \left (f x + e\right )}\right ) + {\left (b^{2} c^{2} d - b^{2} d^{3}\right )} \cos \left (f x + e\right )}{{\left (c^{2} d^{2} - d^{4}\right )} f}\right ] \]

[In]

integrate((a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="fricas")

[Out]

[-1/2*(2*(b^2*c^3 - 2*a*b*c^2*d - b^2*c*d^2 + 2*a*b*d^3)*f*x + (b^2*c^2 - 2*a*b*c*d + a^2*d^2)*sqrt(-c^2 + d^2
)*log(((2*c^2 - d^2)*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2 + 2*(c*cos(f*x + e)*sin(f*x + e) + d*cos(
f*x + e))*sqrt(-c^2 + d^2))/(d^2*cos(f*x + e)^2 - 2*c*d*sin(f*x + e) - c^2 - d^2)) + 2*(b^2*c^2*d - b^2*d^3)*c
os(f*x + e))/((c^2*d^2 - d^4)*f), -((b^2*c^3 - 2*a*b*c^2*d - b^2*c*d^2 + 2*a*b*d^3)*f*x + (b^2*c^2 - 2*a*b*c*d
 + a^2*d^2)*sqrt(c^2 - d^2)*arctan(-(c*sin(f*x + e) + d)/(sqrt(c^2 - d^2)*cos(f*x + e))) + (b^2*c^2*d - b^2*d^
3)*cos(f*x + e))/((c^2*d^2 - d^4)*f)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 4032 vs. \(2 (78) = 156\).

Time = 121.58 (sec) , antiderivative size = 4032, normalized size of antiderivative = 44.31 \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\text {Too large to display} \]

[In]

integrate((a+b*sin(f*x+e))**2/(c+d*sin(f*x+e)),x)

[Out]

Piecewise((zoo*x*(a + b*sin(e))**2/sin(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), ((a**2*log(tan(e/2 + f*x/2))*tan(e
/2 + f*x/2)**2/(f*tan(e/2 + f*x/2)**2 + f) + a**2*log(tan(e/2 + f*x/2))/(f*tan(e/2 + f*x/2)**2 + f) + 2*a*b*f*
x*tan(e/2 + f*x/2)**2/(f*tan(e/2 + f*x/2)**2 + f) + 2*a*b*f*x/(f*tan(e/2 + f*x/2)**2 + f) - 2*b**2/(f*tan(e/2
+ f*x/2)**2 + f))/d, Eq(c, 0)), (2*a**2*d*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*
tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 2*a**2*d*sqrt(d**2)/(d**3*f*tan(e/
2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 2*a*b*d**2*
f*x*tan(e/2 + f*x/2)**3/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/
2)**2 - f*(d**2)**(3/2)) + 2*a*b*d**2*f*x*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/
2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 4*a*b*d**2*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 +
 f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 4*a*b*d**2/(d*
*3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) -
2*a*b*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(
3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) - 2*a*b*d*f*x*sqrt(d**2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(
e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) - b**2*d**2*f*x*tan(e/2 + f*x/2)**2/(d**
3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) - b
**2*d**2*f*x/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(
d**2)**(3/2)) - 2*b**2*d**2*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)*
*(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + b**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)**3/(d**3*f*tan(e/2 + f*
x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + b**2*d*f*x*sqrt(d
**2)*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)
**2 - f*(d**2)**(3/2)) + 2*b**2*d*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2
+ f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)) + 4*b**2*d*sqrt(d**2)/(d**3*f*tan(e/2 + f*x/
2)**3 + d**3*f*tan(e/2 + f*x/2) - f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 - f*(d**2)**(3/2)), Eq(c, -sqrt(d**2))),
 (-2*a**2*d*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(
3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - 2*a**2*d*sqrt(d**2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2
 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) + 2*a*b*d**2*f*x*tan(e/2 + f*x/2)**3/(d**3*
f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) + 2*a
*b*d**2*f*x*tan(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 +
 f*x/2)**2 + f*(d**2)**(3/2)) + 4*a*b*d**2*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 +
f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) + 4*a*b*d**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**
3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) + 2*a*b*d*f*x*sqrt(d**2)*tan(e/2
 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(
d**2)**(3/2)) + 2*a*b*d*f*x*sqrt(d**2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)
*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - b**2*d**2*f*x*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3
*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - b**2*d**2*f*x/(d**3*f*tan(e/2 +
 f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - 2*b**2*d**2*ta
n(e/2 + f*x/2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f
*(d**2)**(3/2)) - b**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)**3/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x
/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - b**2*d*f*x*sqrt(d**2)*tan(e/2 + f*x/2)/(d**3*f*
tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - 2*b**
2*d*sqrt(d**2)*tan(e/2 + f*x/2)**2/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2) + f*(d**2)**(3/2)*tan
(e/2 + f*x/2)**2 + f*(d**2)**(3/2)) - 4*b**2*d*sqrt(d**2)/(d**3*f*tan(e/2 + f*x/2)**3 + d**3*f*tan(e/2 + f*x/2
) + f*(d**2)**(3/2)*tan(e/2 + f*x/2)**2 + f*(d**2)**(3/2)), Eq(c, sqrt(d**2))), ((a**2*x - 2*a*b*cos(e + f*x)/
f + b**2*x*sin(e + f*x)**2/2 + b**2*x*cos(e + f*x)**2/2 - b**2*sin(e + f*x)*cos(e + f*x)/(2*f))/c, Eq(d, 0)),
(x*(a + b*sin(e))**2/(c + d*sin(e)), Eq(f, 0)), (a**2*d**2*log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)*
tan(e/2 + f*x/2)**2/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) + a**2*d**2*lo
g(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(
-c**2 + d**2)) - a**2*d**2*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)*tan(e/2 + f*x/2)**2/(d**2*f*sqrt
(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) - a**2*d**2*log(tan(e/2 + f*x/2) + d/c + sqrt(
-c**2 + d**2)/c)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) - 2*a*b*c*d*log(t
an(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)*tan(e/2 + f*x/2)**2/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)*
*2 + d**2*f*sqrt(-c**2 + d**2)) - 2*a*b*c*d*log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(d**2*f*sqrt(-c
**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) + 2*a*b*c*d*log(tan(e/2 + f*x/2) + d/c + sqrt(-c*
*2 + d**2)/c)*tan(e/2 + f*x/2)**2/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2))
+ 2*a*b*c*d*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2
+ d**2*f*sqrt(-c**2 + d**2)) + 2*a*b*d*f*x*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2/(d**2*f*sqrt(-c**2 + d**2)*t
an(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) + 2*a*b*d*f*x*sqrt(-c**2 + d**2)/(d**2*f*sqrt(-c**2 + d**2)*ta
n(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) + b**2*c**2*log(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)*
tan(e/2 + f*x/2)**2/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) + b**2*c**2*lo
g(tan(e/2 + f*x/2) + d/c - sqrt(-c**2 + d**2)/c)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(
-c**2 + d**2)) - b**2*c**2*log(tan(e/2 + f*x/2) + d/c + sqrt(-c**2 + d**2)/c)*tan(e/2 + f*x/2)**2/(d**2*f*sqrt
(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) - b**2*c**2*log(tan(e/2 + f*x/2) + d/c + sqrt(
-c**2 + d**2)/c)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) - b**2*c*f*x*sqrt
(-c**2 + d**2)*tan(e/2 + f*x/2)**2/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2))
 - b**2*c*f*x*sqrt(-c**2 + d**2)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)) -
 2*b**2*d*sqrt(-c**2 + d**2)/(d**2*f*sqrt(-c**2 + d**2)*tan(e/2 + f*x/2)**2 + d**2*f*sqrt(-c**2 + d**2)), True
))

Maxima [F(-2)]

Exception generated. \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate((a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*d^2-4*c^2>0)', see `assume?`
 for more de

Giac [A] (verification not implemented)

none

Time = 0.31 (sec) , antiderivative size = 130, normalized size of antiderivative = 1.43 \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=-\frac {\frac {{\left (b^{2} c - 2 \, a b d\right )} {\left (f x + e\right )}}{d^{2}} + \frac {2 \, b^{2}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 1\right )} d} - \frac {2 \, {\left (b^{2} c^{2} - 2 \, a b c d + a^{2} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (c\right ) + \arctan \left (\frac {c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + d}{\sqrt {c^{2} - d^{2}}}\right )\right )}}{\sqrt {c^{2} - d^{2}} d^{2}}}{f} \]

[In]

integrate((a+b*sin(f*x+e))^2/(c+d*sin(f*x+e)),x, algorithm="giac")

[Out]

-((b^2*c - 2*a*b*d)*(f*x + e)/d^2 + 2*b^2/((tan(1/2*f*x + 1/2*e)^2 + 1)*d) - 2*(b^2*c^2 - 2*a*b*c*d + a^2*d^2)
*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(c) + arctan((c*tan(1/2*f*x + 1/2*e) + d)/sqrt(c^2 - d^2)))/(sqrt(c^2 -
d^2)*d^2))/f

Mupad [B] (verification not implemented)

Time = 12.96 (sec) , antiderivative size = 2629, normalized size of antiderivative = 28.89 \[ \int \frac {(3+b \sin (e+f x))^2}{c+d \sin (e+f x)} \, dx=\text {Too large to display} \]

[In]

int((a + b*sin(e + f*x))^2/(c + d*sin(e + f*x)),x)

[Out]

(2*b*atan((64*b^6*c^4*tan(e/2 + (f*x)/2))/(64*b^6*c^4 + 128*a^2*b^4*c^4 - 512*a^3*b^3*c*d^3 - 512*a^3*b^3*c^3*
d + 768*a^2*b^4*c^2*d^2 + 576*a^4*b^2*c^2*d^2 - 384*a*b^5*c^3*d - 128*a^5*b*c*d^3) + (384*a*b^5*c^3*tan(e/2 +
(f*x)/2))/(384*a*b^5*c^3 + 512*a^3*b^3*c^3 - (64*b^6*c^4)/d - 768*a^2*b^4*c^2*d + 512*a^3*b^3*c*d^2 - 576*a^4*
b^2*c^2*d - (128*a^2*b^4*c^4)/d + 128*a^5*b*c*d^2) + (768*a^2*b^4*c^2*tan(e/2 + (f*x)/2))/(768*a^2*b^4*c^2 + 5
76*a^4*b^2*c^2 + (64*b^6*c^4)/d^2 - (384*a*b^5*c^3)/d - 128*a^5*b*c*d - (512*a^3*b^3*c^3)/d + (128*a^2*b^4*c^4
)/d^2 - 512*a^3*b^3*c*d) + (576*a^4*b^2*c^2*tan(e/2 + (f*x)/2))/(768*a^2*b^4*c^2 + 576*a^4*b^2*c^2 + (64*b^6*c
^4)/d^2 - (384*a*b^5*c^3)/d - 128*a^5*b*c*d - (512*a^3*b^3*c^3)/d + (128*a^2*b^4*c^4)/d^2 - 512*a^3*b^3*c*d) +
 (512*a^3*b^3*c^3*tan(e/2 + (f*x)/2))/(384*a*b^5*c^3 + 512*a^3*b^3*c^3 - (64*b^6*c^4)/d - 768*a^2*b^4*c^2*d +
512*a^3*b^3*c*d^2 - 576*a^4*b^2*c^2*d - (128*a^2*b^4*c^4)/d + 128*a^5*b*c*d^2) + (128*a^2*b^4*c^4*tan(e/2 + (f
*x)/2))/(64*b^6*c^4 + 128*a^2*b^4*c^4 - 512*a^3*b^3*c*d^3 - 512*a^3*b^3*c^3*d + 768*a^2*b^4*c^2*d^2 + 576*a^4*
b^2*c^2*d^2 - 384*a*b^5*c^3*d - 128*a^5*b*c*d^3) - (128*a^5*b*c*d*tan(e/2 + (f*x)/2))/(768*a^2*b^4*c^2 + 576*a
^4*b^2*c^2 + (64*b^6*c^4)/d^2 - (384*a*b^5*c^3)/d - 128*a^5*b*c*d - (512*a^3*b^3*c^3)/d + (128*a^2*b^4*c^4)/d^
2 - 512*a^3*b^3*c*d) - (512*a^3*b^3*c*d*tan(e/2 + (f*x)/2))/(768*a^2*b^4*c^2 + 576*a^4*b^2*c^2 + (64*b^6*c^4)/
d^2 - (384*a*b^5*c^3)/d - 128*a^5*b*c*d - (512*a^3*b^3*c^3)/d + (128*a^2*b^4*c^4)/d^2 - 512*a^3*b^3*c*d))*(2*a
*d - b*c))/(d^2*f) - (2*b^2)/(d*f*(tan(e/2 + (f*x)/2)^2 + 1)) - (atan((((-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2
*((32*(b^4*c^4*d - 4*a*b^3*c^3*d^2 + 4*a^2*b^2*c^2*d^3))/d^2 - (32*tan(e/2 + (f*x)/2)*(a^4*c*d^5 + 2*b^4*c^5*d
 - 2*b^4*c^3*d^3 + 8*a*b^3*c^2*d^4 - 8*a*b^3*c^4*d^2 - 8*a^2*b^2*c*d^5 - 4*a^3*b*c^2*d^4 + 10*a^2*b^2*c^3*d^3)
)/d^3 + ((-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2*((32*(a^2*c^2*d^4 + b^2*c^2*d^4 - 2*a*b*c*d^5))/d^2 + (32*tan(
e/2 + (f*x)/2)*(2*a^2*c*d^6 + 2*b^2*c^3*d^4 - 4*a*b*c^2*d^5))/d^3 + ((32*c^2*d^3 + (32*tan(e/2 + (f*x)/2)*(3*c
*d^7 - 2*c^3*d^5))/d^3)*(-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2)/(d^4 - c^2*d^2)))/(d^4 - c^2*d^2))*1i)/(d^4 -
c^2*d^2) - ((-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2*((32*tan(e/2 + (f*x)/2)*(a^4*c*d^5 + 2*b^4*c^5*d - 2*b^4*c^
3*d^3 + 8*a*b^3*c^2*d^4 - 8*a*b^3*c^4*d^2 - 8*a^2*b^2*c*d^5 - 4*a^3*b*c^2*d^4 + 10*a^2*b^2*c^3*d^3))/d^3 - (32
*(b^4*c^4*d - 4*a*b^3*c^3*d^2 + 4*a^2*b^2*c^2*d^3))/d^2 + ((-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2*((32*(a^2*c^
2*d^4 + b^2*c^2*d^4 - 2*a*b*c*d^5))/d^2 + (32*tan(e/2 + (f*x)/2)*(2*a^2*c*d^6 + 2*b^2*c^3*d^4 - 4*a*b*c^2*d^5)
)/d^3 - ((32*c^2*d^3 + (32*tan(e/2 + (f*x)/2)*(3*c*d^7 - 2*c^3*d^5))/d^3)*(-(c + d)*(c - d))^(1/2)*(a*d - b*c)
^2)/(d^4 - c^2*d^2)))/(d^4 - c^2*d^2))*1i)/(d^4 - c^2*d^2))/((64*tan(e/2 + (f*x)/2)*(2*b^6*c^5 + 8*a^4*b^2*c*d
^4 + 26*a^2*b^4*c^3*d^2 - 24*a^3*b^3*c^2*d^3 - 12*a*b^5*c^4*d))/d^3 - (64*(a^2*b^4*c^4 - 4*a^3*b^3*c^3*d + 5*a
^4*b^2*c^2*d^2 - 2*a^5*b*c*d^3))/d^2 + ((-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2*((32*(b^4*c^4*d - 4*a*b^3*c^3*d
^2 + 4*a^2*b^2*c^2*d^3))/d^2 - (32*tan(e/2 + (f*x)/2)*(a^4*c*d^5 + 2*b^4*c^5*d - 2*b^4*c^3*d^3 + 8*a*b^3*c^2*d
^4 - 8*a*b^3*c^4*d^2 - 8*a^2*b^2*c*d^5 - 4*a^3*b*c^2*d^4 + 10*a^2*b^2*c^3*d^3))/d^3 + ((-(c + d)*(c - d))^(1/2
)*(a*d - b*c)^2*((32*(a^2*c^2*d^4 + b^2*c^2*d^4 - 2*a*b*c*d^5))/d^2 + (32*tan(e/2 + (f*x)/2)*(2*a^2*c*d^6 + 2*
b^2*c^3*d^4 - 4*a*b*c^2*d^5))/d^3 + ((32*c^2*d^3 + (32*tan(e/2 + (f*x)/2)*(3*c*d^7 - 2*c^3*d^5))/d^3)*(-(c + d
)*(c - d))^(1/2)*(a*d - b*c)^2)/(d^4 - c^2*d^2)))/(d^4 - c^2*d^2)))/(d^4 - c^2*d^2) + ((-(c + d)*(c - d))^(1/2
)*(a*d - b*c)^2*((32*tan(e/2 + (f*x)/2)*(a^4*c*d^5 + 2*b^4*c^5*d - 2*b^4*c^3*d^3 + 8*a*b^3*c^2*d^4 - 8*a*b^3*c
^4*d^2 - 8*a^2*b^2*c*d^5 - 4*a^3*b*c^2*d^4 + 10*a^2*b^2*c^3*d^3))/d^3 - (32*(b^4*c^4*d - 4*a*b^3*c^3*d^2 + 4*a
^2*b^2*c^2*d^3))/d^2 + ((-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2*((32*(a^2*c^2*d^4 + b^2*c^2*d^4 - 2*a*b*c*d^5))
/d^2 + (32*tan(e/2 + (f*x)/2)*(2*a^2*c*d^6 + 2*b^2*c^3*d^4 - 4*a*b*c^2*d^5))/d^3 - ((32*c^2*d^3 + (32*tan(e/2
+ (f*x)/2)*(3*c*d^7 - 2*c^3*d^5))/d^3)*(-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2)/(d^4 - c^2*d^2)))/(d^4 - c^2*d^
2)))/(d^4 - c^2*d^2)))*(-(c + d)*(c - d))^(1/2)*(a*d - b*c)^2*2i)/(f*(d^4 - c^2*d^2))